<template>
    <div class="zc-layout-header-brand">
        <a href="">
            <div class="zc-company-avtar">{{ app.avatar }}</div>
        </a>
        <a href="">
            <div class="zc-company-title">{{ app.name }}</div>
        </a>
    </div>
    <div class="zc-layout-header-bar">
        <Avatar></Avatar>
    </div>
</template>
<script setup type="ts">
import Avatar from "@/views/layouts/core/avatar.vue";
import {AppStore} from '@/stores/app'
import {CompanyStore} from '@/stores/company'
import {onBeforeMount} from "vue";
import router from "@/router";
import {storeToRefs} from "pinia";
const appStore = AppStore();
const companyStore = CompanyStore();
const {app} = storeToRefs(appStore);
const {company} = storeToRefs(companyStore);
onBeforeMount(() => {
    if (!company.value?.id) {
        companyStore.doLoadCompany(router.currentRoute.value.params.companyId);
    }
    if (!app.value?.id) {
        appStore.doLoadApp(router.currentRoute.value.params.appId);
    }
})

</script>
